stack = []
s = "([]{}<>)"


for i in s:
    if i in "([{<":
        stack.append(i)
    else:
            if i =="(" and stack[-1] == '(':
                    stack.pop()
                    print(stack)
            elif i == "}" and stack[-1] == '{':
                    stack.pop()
                    print(stack)
            elif i  == "]" and stack[-1] == '[':
                    stack.pop()
                    print(stack)
            elif i == ">" and stack[-1] == '<':
                    stack.pop()
                    print(stack)
            else:
                    break
print(stack)
if len(stack) == 0:
        print('true')
else:
        print('false')
